package xuhaijia.lanou3g.autohome.recommend.recommendreusing;
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//                  \./                   \\`.
//        .'//            为什么坚持  想一想当初             \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-.  \\`.
//    .'//.-"                 `-.  |  .-'                 "-. \\`.
//  .'//______.============-..   \ | /   ..-============._______\\`.
//.'//____________________________\|/_____________________________\\`.
// 
//                             

import android.os.Bundle;
import android.widget.ListView;

import xuhaijia.lanou3g.autohome.R;
import xuhaijia.lanou3g.autohome.base.BaseFragment;
import xuhaijia.lanou3g.autohome.base.NetTool;

/**
 * Created by 7 on 16/8/18.
 */
public class RecSameFragment extends BaseFragment {

    private ListView listView;
    private RecommendSameAdapter adapter;

    public static RecSameFragment getInstance(String urls){
        Bundle bundle = new Bundle();
        bundle.putString("url", urls);
        RecSameFragment recSameFragment = new RecSameFragment();
        recSameFragment.setArguments(bundle);
        return recSameFragment;
    }

    @Override
    protected int setLayout() {
        return R.layout.fragment_listview;
    }

    @Override
    protected void initView() {
        listView = bindView(R.id.lv);
    }

    @Override
    protected void initData() {
        Bundle b = getArguments();
        String url = b.getString("url");
        adapter = new RecommendSameAdapter(mContext);
        mNetTool.getNetData(url, RecommendBean.class, new NetTool.NetListener<RecommendBean>() {
            @Override
            public void onSuccess(RecommendBean recommendBean) {
                adapter.setRecommendBean(recommendBean);
                listView.setAdapter(adapter);
            }

            @Override
            public void onError(String errorMsg) {

            }
        });
    }

    @Override
    public void load() {

    }

    @Override
    public void refresh() {

    }
}
